package de.koller.hydrogen.input;

import de.koller.aframe.plain.InputPlain;
import de.koller.hydrogen.HNode;
import java.awt.event.KeyEvent;

public class HInput extends HNode {
	private InputPlain input;

	@Override
	protected void init() {
		super.init();
		
		input = new InputPlain( hroot.display );
		this.addChild( input );
	}

	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		if( input.isKeyPressed( KeyEvent.VK_F12 ) )
			hroot.stop();
			
		cameraSteering();
	}
	
	private void cameraSteering() {
		if( input.getMouseWheel() != 0 )	
			hroot.render.camera.scaleCamera( (float)input.getMouseWheel(), input.getMouseX(), input.getMouseY() );
		
		if( input.isMouseDown( 3 ) )
			hroot.render.camera.moveCameraInPixel( input.getMouseDX(), input.getMouseDY() );
	}
}
